package com.suredy.app.project.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

import com.suredy.core.model.BaseModel;

/**
 * 付款明细
 * 
 * @author VIVID.G
 * @since 2015-7-30
 * @version v0.1
 */
@Entity
@Table(name = "tb_contract_payment")
public class ContractPayment extends BaseModel {

	private static final long serialVersionUID = 1L;

	/* 收款金额 */
	@Column(nullable = false, columnDefinition = "float(255,2) default 0.00")
	private Float amount;

	/* 收款日期 */
	@Column(nullable = false)
	@DateTimeFormat(iso = ISO.DATE)
	private Date date;

	/* 收款描述 */
	@Column(length = 500)
	private String des;

	/* 合同 */
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	@JoinColumn(name = "contract_id")
	private Contract contract;

	public Float getAmount() {
		return amount;
	}

	public void setAmount(Float amount) {
		this.amount = amount;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	public Contract getContract() {
		return contract;
	}

	public void setContract(Contract contract) {
		this.contract = contract;
	}

}
